package cn.stylefeng.guns.modular.business.frequency.orderarrive.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderarrive.service.OrderArriveService;
import cn.stylefeng.guns.modular.business.frequency.orderarrive.model.param.OrderArriveParam;

import javax.annotation.Resource;

/**
 * 订单确认到达表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:17
 */
@RestController
public class OrderArriveController {

    @Resource
    private OrderArriveService orderArriveService;

    /**
     * 分页查询订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/orderArrive/page")
    @BusinessLog(title = "订单确认到达表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderArriveParam orderArriveParam) {
        return new SuccessResponseData(orderArriveService.page(orderArriveParam));
    }

    /**
     * 获取全部订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/orderArrive/list")
    @BusinessLog(title = "订单确认到达表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderArriveParam orderArriveParam) {
        return new SuccessResponseData(orderArriveService.list(orderArriveParam));
    }

    /**
     * 查看详情订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/orderArrive/detail")
    @BusinessLog(title = "订单确认到达表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderArriveParam.detail.class) OrderArriveParam orderArriveParam) {
        return new SuccessResponseData(orderArriveService.detail(orderArriveParam));
    }

    /**
     * 添加订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/orderArrive/add")
    @BusinessLog(title = "订单确认到达表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderArriveParam.add.class) OrderArriveParam orderArriveParam) {
        orderArriveService.add(orderArriveParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/orderArrive/delete")
    @BusinessLog(title = "订单确认到达表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderArriveParam.delete.class) OrderArriveParam orderArriveParam) {
        orderArriveService.delete(orderArriveParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单确认到达表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/orderArrive/edit")
    @BusinessLog(title = "订单确认到达表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderArriveParam.edit.class) OrderArriveParam orderArriveParam) {
        orderArriveService.edit(orderArriveParam);
        return new SuccessResponseData();
    }


}
